package org.nepu.srr.设备设施资料.通信及航行设备证书;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.domain.CommonIn;
import org.nepu.sc.domain.CommonMethods;

@Data
public class B4bComParams {
    @ApiModelProperty("无线电收发机")
    CommonIn radioTransmitterReceiver;

    @ApiModelProperty("卫星通信系统")
    CommonIn satelliteCommunicationSystem;

    @ApiModelProperty("直升机导航仪")
    CommonIn aircraftNavigationSystem;

    @ApiModelProperty("双向高频电话")
    CommonIn twoWayHighFrequencyTelephone;

    @ApiModelProperty("广播电话系统")
    CommonIn broadcastTelephoneSystem;

    @ApiModelProperty("通用报警系统")
    CommonIn generalAlarmSystem;

    @ApiModelProperty("航行警告接收机")
    CommonIn flightWarningReceiver;

    @ApiModelProperty("雷达应答器")
    CommonIn radarAnsweringMachine;

    @ApiModelProperty("气象及海况仪器")
    CommonIn weatherAndMarineInstruments;

    @ApiModelProperty("应急通信设备")
    CommonIn emergencyCommunicationDevice;

    @ApiModelProperty("雾笛系统")
    CommonIn windChimeSystem;

    @ApiModelProperty("障碍灯")
    CommonIn obstacleLight;

    @ApiModelProperty("信号灯")
    CommonIn signalLight;

    @ApiModelProperty("测深仪")
    CommonIn depthMeasuringInstrument;

    @ApiModelProperty("船舶自动识别系统")
    CommonIn shipAutomaticIdentificationSystem;

    public B4bComResult rate(){
        double fullScore = 75;
        double score = 0;
        if(CommonMethods.isAllTrue(radioTransmitterReceiver.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(satelliteCommunicationSystem.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(aircraftNavigationSystem.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(twoWayHighFrequencyTelephone.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(broadcastTelephoneSystem.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(generalAlarmSystem.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(flightWarningReceiver.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(radarAnsweringMachine.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(weatherAndMarineInstruments.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(emergencyCommunicationDevice.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(windChimeSystem.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(obstacleLight.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(signalLight.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(depthMeasuringInstrument.getInput())){
            score += 5;
        }
        if(CommonMethods.isAllTrue(shipAutomaticIdentificationSystem.getInput())){
            score += 5;
        }
        double rate = score / fullScore;
        B4bComResult result = new B4bComResult();
        result.setRateScore(rate);
        String s = CommonMethods.toGrade(rate);
        result.setRateResult(s);
        return result;
    }
}
